package com.jmc.interfaces;

import java.awt.Dimension;
import javax.swing.JButton;

import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JTextField;

import com.jmc.calls.ListSpool;
import com.jmc.calls.TestProgramCallPD0008;




/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MainPanel extends javax.swing.JPanel {
	private JButton RunBt;
	private JButton listSpool;
	private JTextField jDir;

	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new MainPanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	public MainPanel() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setPreferredSize(new Dimension(400, 300));
			{
				RunBt = new JButton();
				this.add(RunBt);
				RunBt.setText("Run");
				RunBt.addActionListener(new java.awt.event.ActionListener() {
		            public void actionPerformed(java.awt.event.ActionEvent evt) {
		                jbRunActionPerformed(evt);
		            }
				});
			}
			{
				jDir = new JTextField();
				this.add(jDir);
				jDir.setText("/QSYS.LIB/TRFPGMLIB.LIB/PD0008CLWE.CLP");
				jDir.setPreferredSize(new java.awt.Dimension(269, 22));
			}
			{
				listSpool = new JButton();
				this.add(listSpool);
				listSpool.setText("listSpool");
				listSpool.addActionListener(new java.awt.event.ActionListener() {
		            public void actionPerformed(java.awt.event.ActionEvent evt) {
		                jblistActionPerformed(evt);
		            }
				});

			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private void jbRunActionPerformed(java.awt.event.ActionEvent evt) {    	
		System.out.println("Comienza a Correr");
		TestProgramCallPD0008 testProgramCallPD0008 = new TestProgramCallPD0008(); 
		testProgramCallPD0008.runPG(jDir.getText());
		System.out.println("Fin a Correr");
		
	}
	private void jblistActionPerformed(java.awt.event.ActionEvent evt) {    	
		System.out.println("Comienza a listar");
		ListSpool listSpool = new ListSpool(); 
		listSpool.listar();
		System.out.println("Fin a listar");
		
	}

}
